//
//  FFWalletVC.m
//  LLWallet
//
//  Created by tt on 2020/8/16.
//

#import "FFWalletVC.h"
#import "FFWalletConst.h"
@interface FFWalletVC ()

@end

@implementation FFWalletVC

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.viewModel = [FFWalletVM new];
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self requestWalletInfo];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshWalletInfo) name:LIM_NOTIFY_WALLET_REFRESH object:nil];
}

- (NSString *)langTitle {
    return LLang(@"我的钱包");
}

- (void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self name:LIM_NOTIFY_WALLET_REFRESH object:nil];
}

-(void) refreshWalletInfo {
    [self requestWalletInfo];
}

-(void) requestWalletInfo {
    __weak typeof(self) weakSelf = self;
       [self.viewModel myWallet:^(NSError * _Nonnull error) {
           if(error) {
               [weakSelf.view showMsg:error.domain];
               return;
           }
           [weakSelf reloadData];
    }];
}
@end
